jQuery(document).ready(function ($) {
	"use strict";
	$('#recommendList').perfectScrollbar();
});

window.onload=function(){
//				滑动导航栏
	var navs = $('#navItems div a');
	var len = 49*navs.length;
	for(var i=0,j=navs.length;i<j;i++){
		len+=$(navs[i]).width();
	}
//				next箭头
	$('.next').click(function(){
		if(navItems.scrollLeft<=(len-792))
			navItems.scrollLeft+=150;
	});
	$('.previous').click(function(){
		if(navItems.scrollLeft>0)
			navItems.scrollLeft-=150;
	});
	
//				推荐信息前的小点
	var recommendList = $('.recommendList div div');
	for(var i=0,j=recommendList.length; i<j; i++){
		var newHtml ='<img src="img/recommand_point.png"/>'+$(recommendList[i]).html();
		$(recommendList[i]).html(newHtml);
	}
	
//				发布时间前的小点
	var infoTimes = $('.infoTime');
	for(var i=0,j=infoTimes.length; i<j; i++){
		var newHtml ='<img src="img/round_time.png"/>'+$(infoTimes[i]).html();
		$(infoTimes[i]).html(newHtml);
	}
	

//				跟随滚动条浮动的div
	$(window).bind("scroll",function(){
		if($(window).scrollTop()>$('.recommendInfo')[0].offsetTop+$('.recommendInfo').height()-464){
			$('.recommendInfo').css({'position':'fixed','top':'-725px'});
			$('.divvvvv').css({'margin-left':'431px'});
		}
		if($(window).scrollTop()<=850){
			$('.recommendInfo').css({'position':'static'});
			$('.divvvvv').css({'margin-left':'23px'});
		}
	});
	
	$('.infoTitle').click(function(){
//		$('.recommendList')[0].style.display='none';
		$('.infoDetail')[0].style.display='block';
		$('.infoList')[0].style.display='none';
	});
	
//	推荐信息竖条长度
	$('.recommendBg').css('height',$('.recommendList div div').length*$($('.recommendList div div')[0]).height()-22+'px');
};

var showHide = function(){
	$('.hide').css('display','block');
}